import ajax from '@utils/ajax'

/**
 * @module 资金管理
 * @param {*} params 
 * @api_address http://wiki.czb365.com/pages/viewpage.action?pageId=42902623
 */

const baseUrl = ''

/**
 * @submodule 提现资金管理
 */

const capitalUrl =  `${baseUrl}/financeManage`

// 获取商户|油站的所有D0账户，账户余额、账户信息
// 传参：companyId  OR   gasId    其中一项必填
export const getAllD0AccountApi = params => ajax.post(`${capitalUrl}/getAllD0Account`, params)

// 账户详情，账户余额、账户信息
export const getAccountInfoApi = params => ajax.post(`${capitalUrl}/getAccountInfo`, params)

// 提现
export const withdrawSubmitApi = params => ajax.post(`${capitalUrl}/withdraw `, params)

// 更改提现方式（自动｜手动）
export const updateWithdrawTypeApi = params => ajax.post(`${capitalUrl}/updateWithdrawType `, params)

// 中顺易开通协议
export const signAgreementApi = params => ajax.post(`${capitalUrl}/agreementZSY`, params)

// 平安鉴权，触发鉴权
export const triggerAuthApi = params => ajax.post(`${capitalUrl}/authenticating`, params)

// 平安鉴权，小额鉴权，获取银行是否打款成功
export const smallAmountTransferCheckApi =  params => ajax.post(`${capitalUrl}/smallAmountTransferCheck`, params)

// 平安鉴权，鉴权是否成功
export const authenticationApi = params => ajax.post(`${capitalUrl}/checkAuthenticate`, params)

// 查询props：交易类型
export const getQueryTradeTypeApi = params => ajax.post(`${capitalUrl}/getTradingType`, params)

// 资金明细：信息汇总
export const getDetailSummaryApi = params => ajax.post(`${capitalUrl}/getCapitalSummary`, params)

// 资金明细：列表
export const getDetailListApi = params => ajax.post(`${capitalUrl}/getCapitalListByPage`, params)

// 资金明细：导出
export const downloadDetailsApi = data => ajax.post(`${capitalUrl}/exportCapitalList`,data)

// 提现：获取手续费
export const getServiceFeeApi = params => ajax.post(`${capitalUrl}/calcCharge`, params)

// 判断是否存在允许提现
export const isAllowWithdrawApi = params => ajax.post(`${capitalUrl}/judgeRepaidBill`, params)

// 获取账户自动提现时间
export const getAutoWithdrawTimeApi = params => ajax.post(`${capitalUrl}/getAutoWithdrawTime`, params)

/**
 * @submodule 预存款资金管理
 */

const predepositsUrl =  `${baseUrl}/financeManage`

//预存款余额信息
export const getDepositsInfoApi = params => ajax.post(`${predepositsUrl}/getAdvanceAccountBalanceInfo`, params)

//列表 tab props：预存款账户交易类别
export const getQueryTradeCategoryApi = params => ajax.post(`${predepositsUrl}/getAdvanceTradingCategory`, params)

//列表 tab props：预存款账户交易类型
export const getQueryDepositsTradeTypeApi = params => ajax.post(`${predepositsUrl}/getAdvanceTradingType`, params)

//预存款账户列表
export const getDepositsListApi = params => ajax.post(`${predepositsUrl}/getAdvanceCapitalList`, params)

//预存款导出
export const downloadDepositsApi = data => ajax.post(`${capitalUrl}/exportAdvanceCapitalList`,data)

/**
 * @module 账单管理
 * @param {*} params 
 * @api_address http://wiki.czb365.com/pages/viewpage.action?pageId=42909770
 */

/**
 * @submodule 结算日账单
 */

const dailyBillUrl =  `${baseUrl}/gasstationBill`

//查询props：账单状态
export const getDailyQueryStatusApi = params => ajax.post(`${dailyBillUrl}/dailyBillStatusList`, params)

//列表汇总数据
export const getDailyBillSummaryApi = params => ajax.post(`${dailyBillUrl}/queryDailySummaryMoney`, params)

//日账单列表
export const getDailyBillListApi = params => ajax.post(`${dailyBillUrl}/querySettlementDailyBillList`, params)

//日账单导出
export const downloadDailyBillApi = data => ajax.post(`${dailyBillUrl}/exportSettlementDailyBillList`,data)

//日账单明细  查询：账单类型
export const getDailyDetailQueryApi = params => ajax.post(`${dailyBillUrl}/queryBillDetailOrderTypeList`, params)

//日账单明细  表汇总数据
export const getDailyDetailSummaryApi = params => ajax.post(`${dailyBillUrl}/queryDailyDetailSummaryMoney`, params)

//日账单明细  列表
export const getDailyDetailListApi = params => ajax.post(`${dailyBillUrl}/queryBillDetailList`, params)

//日账单明细  导出
export const downloadDailyDetailListApi = data => ajax.post(`${dailyBillUrl}/exportBillDetailList`,data)

// 判断是否以前存在过pos

export const getHasPosRightInHistory = data => ajax.post(`/gasInfo/getHasPosRightInHistory`,data)

/**
 * @submodule 老结算日账单
 */

const oldDailyBillUrl =  `${baseUrl}/gasstationBill`

//查询props
export const getOldBillQueryApi = params => ajax.post(`${oldDailyBillUrl}/queryBillSelectInfo`, params)

//列表汇总数据
export const getOldDailyBillSummaryApi = params => ajax.post(`${oldDailyBillUrl}/queryGasBillSummary`, params)

//日账单列表
export const getOldDailyBillListApi = params => ajax.post(`${oldDailyBillUrl}/queryGasBill`, params)

//日账单导出
export const downloadOldDailyBillApi = data => ajax.post(`${dailyBillUrl}/exportQueryGasBill`,data)
 

//明细(交易流水)： 查询条件
export const getOldFlowQueryApi = params => ajax.post(`${oldDailyBillUrl}/queryBillDetailsSelectInfo`, params)

//明细(交易流水)： 汇总
export const getOldFlowSummaryApi = params => ajax.post(`${oldDailyBillUrl}/queryGasBillDetailsSummary`, params)

//明细(交易流水)： 列表
export const getOldFlowListApi = params => ajax.post(`${oldDailyBillUrl}/queryGasBillDetails`, params)

//明细(交易流水)： 导出
export const downloadOldFlowBillApi = data => ajax.post(`${dailyBillUrl}/exportQueryGasBillDetails`,data)

//明细(交易流水)： 详情
export const getOldFlowDetailApi = params => ajax.post(`${oldDailyBillUrl}/getGasBillDetails`, params)

/**
 * @submodule 通道费月账单
 */

const monthlyBillUrl =  `${baseUrl}/gasstationBill`

//查询props：账单状态
export const getMonthlyQueryStatusApi = params => ajax.post(`${monthlyBillUrl}/billStatusList`, params)

//列表汇总数据
// export const getMonthlyBillSummaryApi = params => ajax.post(`${monthlyBillUrl}/gasSlottingMonthBill/queryMonthSummaryMoney`, params)

//月账单列表
export const getMonthlyBillListApi = params => ajax.post(`${monthlyBillUrl}/querySlottingMonthBillList`, params)

//月账单导出
export const downloadMonthlyBillApi = data => ajax.post(`${monthlyBillUrl}/exportSlottingMonthBillList`,data)

// 查询是否开通过POS
export const getIfHasPos = data  => ajax.post(`gasInfo/getHasPosRightInHistory`,data)

// 查询显示油站或商户权限
export const queryShowStationOrCompany = () => ajax.post('gasInfo/getUserPermissionType')
 
 /**
 * @module 发票管理
 * @param {*} params 
 * @api_address 
 */


/**
 * @submodule 油品发票
 */

const oilInvoiceUrl =  `${baseUrl}/invoice`

//发票信息
export const getOilInvoiceInfoApi = params => ajax.post(`${oilInvoiceUrl}/getInvoiceContent`, params)

//发票金额统计
export const getOilInvoiceBalacneApi = params => ajax.post(`${oilInvoiceUrl}/getOilInvoiceAmount`, params)

//油品发票列表(新)
export const getOilInvoiceListApi = params => ajax.post(`${oilInvoiceUrl}/listOilInvoiceByPage`, params)

//油品发票导出(新)
export const downloadOilInvoiceBillApi = data => ajax.post(`${oilInvoiceUrl}/exportOilInvoice`, data)

//油品发票账单明细(新)
export const getOilInvoiceDetailApi = params => ajax.post(`${oilInvoiceUrl}/oilInvoiceDetail`, params)

//油品发票账单明细导出(新)
export const downloadOilInvoiceDetailApi = data => ajax.post(`${oilInvoiceUrl}/exportOilInvoiceDetail`,data)

/**
 * @submodule 通道费发票
 */

const channelInvoiceUrl =  `${baseUrl}/invoice`

//发票信息
export const getChannelInvoiceInfoApi = params => ajax.post(`${channelInvoiceUrl}/`, params)

//发票金额统计
export const getChannelInvoiceBalacneApi = params => ajax.post(`${channelInvoiceUrl}/getTotalInvoiceAmount`, params)

//查询props：邮寄状态
export const getQuerySendStatusApi = params => ajax.post(`${channelInvoiceUrl}/getMailingStatusEnum`, params)

//查询props：发票状态
export const getQueryInvoiceStatusApi = params => ajax.post(`${channelInvoiceUrl}/getInvoiceStatusEnum`, params)

//通道费发票列表
export const getChannelInvoiceListApi = params => ajax.post(`${channelInvoiceUrl}/chanInvoiceRecordsWithPage`, params)

//通道费发票导出
export const downloadChannelInvoiceBillApi = data => ajax.post(`${channelInvoiceUrl}/exportChanInvoiceRecords`, data)

//申请开票
export const applyChannelInvoiceApi = params => ajax.post(`${channelInvoiceUrl}/applyInvoice`, params)

//发票抬头optons
export const getInvoiceTitleApi = params => ajax.post(`${channelInvoiceUrl}/getInvoiceTitle`, params)

//新增发票信息
export const addInvoiceInfoApi = params => ajax.post(`${channelInvoiceUrl}/addInvoiceInfo`, params)

//编辑发票信息
export const updateInvoiceInfoApi = params => ajax.post(`${channelInvoiceUrl}/updateInvoiceInfo`, params)

//删除发票信息
export const deleteInvoiceInfoApi = params => ajax.post(`${channelInvoiceUrl}/delInvoiceInfo`, params)

//新增发票邮寄地址
export const addInvoiceAddressApi = params => ajax.post(`${channelInvoiceUrl}/addInvoiceAddress`, params)

//编辑发票邮寄地址
export const updateInvoiceAddressApi = params => ajax.post(`${channelInvoiceUrl}/updateInvoiceAddress`, params)

//删除发票邮寄地址
export const deleteInvoiceAddressApi = params => ajax.post(`${channelInvoiceUrl}/delInvoiceAddress`, params)

//查询发票信息
export const getAllInvoiceInfoApi = params => ajax.post(`${channelInvoiceUrl}/getInvoiceInfo`, params)

//查询邮寄地址
export const getAllInvoiceAddressApi = params => ajax.post(`${channelInvoiceUrl}/getInvoiceAddress`, params)

/**
 *  公共使用接口
 */

 // 结算方式枚举
 export const receiveBusinessList = params => ajax.post(`/gasstationBill/receiveBusinessList`, params)
